package com.sharding.issuse.sharding;

import java.util.zip.CRC32;

/**
 * 根据caseId及mod 获取分表标识
 */
public class SplitTableUtil {
    public static Long getTableFlag(Long caseId, int mod) {
        CRC32 crc32 = new CRC32();
        crc32.update(String.valueOf(caseId).trim().getBytes());
        Long flag = crc32.getValue() % mod;
        Long content_crc32 = crc32.getValue();
        return flag;
    }

    public static void main(String[] args) {
        System.out.println(getTableFlag(1L, 7));
    }
}
